<include file="../header" />
<body class="J_scroll_fixed">
<script type="text/javascript" src="__ROOT__/statics/js/ajaxfileupload.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/ueditor/ueditor.all.min.js"></script>

<script type="text/javascript">
    $(function () {

        $("button#send").click(function() {

            $("input[name=description]").val(description.getContent());

            $("form").submit();

        });

        var description = UE.getEditor('description',{
            initialFrameHeight:300,
            initialContent : "",
            serverUrl :'{:U("science/ueditorUpload")}'
        });

        $("button#upload").click(function(){
            //上传文件
            $.ajaxFileUpload({
                url:"{:U('Science/uploadImage')}",//处理图片脚本
                secureuri :false,
                fileElementId :'fileToUpload',//file控件id
                dataType : 'json',
                success : function (data, status){
                    $("input[name=titleImage]").val(data);
                    $("img[name=preImage]").attr("src", data);
                },
                error: function(data, status, e){
                    alert(e);
                }
            })
        });

    });
</script>
<div class="wrap jj">

    <div class="common-form">
        <form method="post" class="form-horizontal J_ajaxForm" action="{:U('science/addPost')}">
            <fieldset>
                <div class="control-group">
                    <label class="control-label">标题名称:</label>
                    <div class="controls">
                        <input type="text" class="input" name="title" value="">
                    </div>
                </div>
                <!--<div class="control-group">-->
                    <!--<label class="control-label">副标题:</label>-->
                    <!--<div class="controls">-->
                        <!--<input type="text" class="input" name="secondTitle" value="">-->
                    <!--</div>-->
                <!--</div>-->
                <div class="control-group">
                    <label class="control-label">医生名称:</label>
                    <div class="controls">
                        <input type="text" class="input" name="doctorName" value="">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">转自:</label>
                    <div class="controls">
                        <input type="text" class="input" name="source" value="">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">图片预览</label>
                    <div class="controls">
                        <img src="" name="preImage" style="width:224px;height:168.5px;" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">站位图片</label>
                    <div class="controls">
                        <input id="fileToUpload" type="file" name="fileToUpload" style="width:170px;">
                        <button class="btn" type="button" id="upload">上传</button>
                        <input type="hidden" name="titleImage" value="" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">所属病症:</label>
                    <div class="controls">
                        <select name="categoryId">
                            {:getCategorySelectOptionHtml(0, 0)}
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">描述内容：</label>
                    <div class="controls">
                        <input type="hidden" name="description" />
                        <script type="text/plain" id="description" name="description"></script>
                    </div>
                </div>

            </fieldset>

            <div class="form-actions">
                <button id="send" type="button" class="btn btn-primary">保存</button>
                <a class="btn" href="__URL__">返回</a>
            </div>
        </form>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>